<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.pie.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->

    <title>A Pie chart using dollar syntax for events</title>
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Pie chart using dollar sytanx to attach a custom click event handler to a segment" />
     
</head>
<body>

    <h1>A Pie chart using dollar syntax for events</h1>
    
    <p>
        This is a Pie chart that uses dollar syntax to attach a custom click event handler to the third segment.
    </p>

    <canvas id="cvs" width="350" height="250">[No canvas support]</canvas>
    
    <script>
        $(document).ready(function ()
        {
            var pie = new RGraph.Pie({
                id: 'cvs',
                data: [4,8,4,6,5,3,2,5],
                options: {
                    labels: ['Alvin','Pete','Hoolio','Jack','Kev','Luis','Lou','Jesse']
                }
            }).draw()
            
            pie.$2.onclick = function (e, shape)
            {
                alert('The segment was clicked!');
            }
            
            pie.$2.onmousemove = function (e, shape)
            {
                e.target.style.cursor = 'pointer';
            }
        })
    </script>

    <p>        
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>